import React from 'react'
import { connect } from 'dva'

import Nav from '../components/Nav'
import UserCard from '../components/UserCard'
import OrderSearch from '../components/OrderSearch'

// addressList

class Index extends React.Component {

    componentDidMount() {
        const { dispatch } = this.props
        dispatch({
            type: 'order/getOrderList'
        })
    }

    toAddressList = () => {
        const { history } = this.props
        history.push('/addressList')
    }

    render() {
        
        return (
            <div>
                <UserCard />
                <OrderSearch />

                <div 
                    className='list-item'
                    onClick={this.toAddressList}
                >
                    <span>我的地址</span>
                    <i className='iconfont icon-fangxiang-xiangyou' />
                </div>

                <Nav />
            </div>
        )
    }
}

export default connect()(Index)
